﻿namespace GmailReader.Tests
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using NUnit.Framework;

    [TestFixture]
    public class AccountReaderShould
    {
        [Test]
        public void RetrieveEmptyListWhenFeedHasNoUnreadedMessages()
        {
            IFeedDownloader downloader = new FeedDownloaderMock { Feed = FeedHelper.EnumFeed.Empty };
            AccountReader reader = new AccountReader(downloader);
            IList<Email> emails = reader.GetUnreadedMails();

            Assert.IsNotNull(emails);
            Assert.AreEqual(0, emails.Count);
        }

        [Test]
        public void RetrieveOneEmailsWhenFeedHasOneEmails()
        {
            IFeedDownloader downloader = new FeedDownloaderMock { Feed = FeedHelper.EnumFeed.One };
            AccountReader reader = new AccountReader(downloader);
            IList<Email> emails = reader.GetUnreadedMails();

            Assert.IsNotNull(emails);
            Assert.AreEqual(1, emails.Count);
        }

        [Test]
        public void RetrieveFiveEmailsWhenFeedHasFiveEmails()
        {
            IFeedDownloader downloader = new FeedDownloaderMock { Feed = FeedHelper.EnumFeed.Five };
            AccountReader reader = new AccountReader(downloader);
            IList<Email> emails = reader.GetUnreadedMails();

            Assert.IsNotNull(emails);
            Assert.AreEqual(5, emails.Count);
        }
    }
}
